package suery.syntax;

import suery.ComponentTreeNode;

/**
 * Class name in expression means to find the component which class name is that
 * in children list.</br>Either full class name of simple class name is right here.
 * 
 * @author Jeky
 * 
 */
public class SearchByClassParser extends AbstractSearchParser {

    @Override
    protected boolean accept(String token, ComponentTreeNode node) {
        Class<?> componentClass = node.getComponent().getClass();
        if (componentClass.getName().equals(token)) {
            return true;
        } else if (componentClass.getSimpleName().equals(token)) {
            return true;
        } else {
            return false;
        }
    }
}
